<!--#include("_header.html")-->

<!--%import("./js/cart.js")-->
<!--%import("./filter/insert_order.xml")-->
<!--%import("./filter/delete_cart.xml")-->

<!--%load_js_plugin("ui.stepper")-->

<form action="./" method="post" onsubmit="return false;" id="cart_form">
<input type="hidden" name="target_var" value="" />
<input type="hidden" name="volume_var" value="" />
<input type="hidden" name="options_var" value="" />

<div class="titleBox">
    <div class="subject"><h1><span>장바구니</span></h1></div>
    <div class="memo"><span>장바구니에 등록하신 상품의 목록입니다.</span></div>
</div>

<div class="lineClear"></div>

<table class="shopList" summary="주문내역 목록리스트">
<caption>장바구니 목록리스트</caption>
<colgroup>
    <col width="5%">
    <col width="35%">
    <col width="15%">
    <col width="15%">
    <col width="10%">
    <col width="20%">
</colgroup>
<thead>
<tr>
    <th scope="col"><input type="checkbox" onclick="XE.checkboxToggleAll({ doClick:true }); return false;"/></th>
    <th scope="col">상품명</th>
    <th scope="col">옵션</th>
    <th scope="col">판매금액</th>
    <th scope="col">수량</th>
    <th scope="col">주문금액</th>
</tr>
</thead>
<tbody>
<!--@if(!$cart_list)-->
    <tr>
        <td colspan="6"> 장바구니에 등록된 상품이 없습니다. </td>
    </tr>
<!--@else-->
    <!--@foreach($cart_list as $no => $val)-->
    {@$output_item = $val->get('item')}
    {@$output_options = explode(',',$val->get('options'))}
	{@$sel_options = null}
	{@$output_price = 0}
	<!--@foreach($output_item->options as $key1 => $val1)-->
		<!--@if( in_array( $val1->option_srl, $output_options ) )-->
			{@$sel_options[] = $val1}
			{@$output_price += $val1->option_price}
		<!--@end-->
	<!--@end-->
	{@$output_price += $val->get('volume')*$output_item->get('price_sale')}

    {@$output_volume = $val->get('volume')}
	<!--@if( $val->get('options') )-->
		{@ $tmp_option_srl = str_replace(',', '-', $val->get('options')) }
		{@ $tmp_srl = $output_item->get('document_srl') ."_". $tmp_option_srl }
	<!--@else-->
		{@ $tmp_srl = $output_item->get('document_srl') }
	<!--@end-->

    <tr>
        <td><input type="checkbox" name="cart" checked="true" value="{$tmp_srl}" /></td>
        <td>
            <div class="cartProduct">
                <a href="{getUrl('','mid',$vid,'document_srl',$output_item->get('document_srl'))}">
                    <!--@if($output_item->getThumbnail(70,40,'crop') == null)-->
                    <img src="img/common/img_blank.gif" width="70" height="40" />
                    <!--@else-->
                    <img src="{$output_item->getThumbnail(70,40,'crop')}" width="70" height="40" />
                    <!--@end-->
                    {$output_item->get('title')}
                </a>
            </div>
        </td>
        <td>
			{@$output_price = 0}
			<!--@foreach($sel_options as $key1 => $val1)-->
				선택옵션 : {$val1->option_name}<!--@if($val1->option_price)--> (+{$val1->option_price}원){@$output_price += $val1->option_price}<!--@end--> <br/>
			<!--@end-->
			<input type="hidden" name="option_{$tmp_srl}" value="{$val->get('options')}" />
		</td>
        <td>{number_format($output_item->get('price_sale'))} 원</td>
        <td>
            <span id="volumn_{$tmp_srl}_ns" class="ui-stepper" onClick="updateValue({$no},{$output_item->get('price_sale')+$output_price},'volumn_{$tmp_srl}');">

            <input type="text" name="volumn_{$tmp_srl}" value="{$output_volume}" class="inputTypeText w40 tRight" />
            </span>
        </td>
        <td><input type="text" name="a_price" id="pi{$no}" value="{number_format($output_volume*($output_item->get('price_sale')+$output_price))}" class="inputTypeTextNone" readonly /> 원</td>
    </tr>
	{@$total_price += $output_volume*($output_item->get('price_sale')+$output_price)}
    <!--@end-->
<!--@end-->
</tbody>
</table>


<table class="priceBox">
    <tr>
        <td class="total" height="32">총 결제금액 : <input type="text" name="total_price" value="{number_format($total_price)}" class="inputTypeTextNone" readonly /> 원</td>
    </tr>
</table>

<!-- 버튼 -->
<span class="rightButtonBox">
	<a href="#" onClick="releaseCheck(delete_cart);" class="button red"><span>삭제</span></a>
	<a href="{getUrl('','mid',$remid)}" class="button white"><span>계속쇼핑하기</span></a>
	<a href="#" onClick="releaseCheck(insert_order);" class="button green"><span>주문</span></a>
</span>

</form>

<!--#include("_footer.html")-->
